using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
using Common;
using Define;

namespace Converters
{
	public class DeviceRunStateConverter : IValueConverter
	{
		public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			if (value != null && value != DependencyProperty.UnsetValue && value is RunningState)
			{
				switch ((RunningState)value)
				{
				case RunningState.Finish:
					return Utility.GetMessage("completed");
				case RunningState.WaitingInterrupt:
				case RunningState.Interrupt:
					return Utility.GetMessage("user_interrupt");
				}
			}
			return value;
		}

		public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return value;
		}
	}
}
